package com.company;

public class Tex {
    public static double sum(double number1, double number2) throws Exception213 {
        if (number1 < 0 || number2 < 0) {
            throw new Exception213("禁用负数");          //当税收小于0时，系统报错
        }
        return (number1 + number2);
    }

    public final static int x = 800;         //static final修饰，一旦给值就不可修改(税的定值)
    public final static int y = 4000;

    public static double avg(double num) throws Exception213 {

        if (num > x) {
            num = num - 800;            //税收第一阶梯
        }
        if (num > y) {
            num = num * 0.8;             //税收第二阶梯
        }
        if (num < x) {
            throw new Exception213("小于800，无需交税");      //小于800，不交税
        }
        return num;
    }
}
